Conversation
aaronashby
left a comment
There was a problem hiding this comment.
LGTM! Good stuff, Pujita 👍🏾
thaninbew
left a comment
There was a problem hiding this comment.
Great work! Most looks good, I left 2 critical suggestions.
There was a problem hiding this comment.
QueryBuilder is stateful, so when we are using it qb for the main query builder we shouldn't reuse it again for the subQuery builder. This is bc it will mutate the same instance from a dirty state. It works in tests but in a real DB there can be issues. Better to be safe and use a separate this.repository.createQueryBuilder() call for the subquery and another clean one for the main query.
| return stats; | ||
| } | ||
|
|
||
| @Get('lapsed') |
There was a problem hiding this comment.
For lapsed donor we also need auth since this endpoint deals with sensitive donor data. Fix is to add two lines under here:
@UseGuards(AuthGuard('jwt'))
@ApiBearerAuth()
otherwise, someone can call this endpoint and get info without auth.
Description
Implements Lapsed Donor Logic in the backend to identify donors whose most recent successful donation occurred more than a specified number of months ago (default: 6 months), and who do not have an active recurring donation.
Changes Made
Repository
Service
Controller
Testing & Verification
Verification Steps:
donations.repository.spec.ts
donations.service.spec.ts
donations.controller.spec.ts
Related Issues
Closes #69